package utils.nfc
{
	import components.valueobjects.PersonVO;
	
	public class NfcTagVcard extends NfcTagObject
	{
		public var vcard:String;

		public function NfcTagVcard(tagID:int,person:PersonVO, contentID:String = "1337", mode:String = "emulator")
		{
			super(tagID, RecordType.RECORD_TYPE_VCARD,contentID,mode);

			this.contentString = person.firstname+" "+person.lastname;
			this.vcard = getVcardUriString(person);
		}
		
		
		
		private function getVcardUriString(person:PersonVO):String{
			var uri:String = "BEGIN:VCARD%0AVERSION:2.1%0AN:" + person.lastname + ";" + person.firstname + "%0AFN:" + person.firstname + "%20" + person.lastname;
			uri += "%0AORG:"+person.company + "%0ATEL;type=HOME:" + person.phone + "%0ATEL;type=CELL:" + person.mobile + "%0AEMAIL;type=INTERNET;type=WORK:" + person.email
				+ "%0AEND:VCARD";
			
			return uri;
		}
	}
}

